<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		if(intval($postdata['groupdiscount'])<1 || $postdata['groupdiscount']>99){
			//exi('拼单折扣必须在1~100范围内','error');
		}
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$bankuai =array(
		array('title'=>'新人专区','img'=>'../addons/jy_weishop/resource/mobile/images/icon/zhekou.png','action'=>'jy_pingdd_pin/index/'),
		array('title'=>'趣味2人团','img'=>'../addons/jy_weishop/resource/mobile/images/icon/shishang.png','action'=>'jy_pingdd_pin/index//teamnum=2'),
		array('title'=>'超值5人团','img'=>'../addons/jy_weishop/resource/mobile/images/icon/pinpai.png','action'=>'jy_pingdd_pin/index//teamnum=5'),
		array('title'=>'秒团百人团','img'=>'../addons/jy_weishop/resource/mobile/images/icon/9.9.png','action'=>'jy_pingdd_pin/index//teamnum=100'),
	);
	$footernav = array(
			array('title'=>'首页','icon'=>'icon-shouye','color'=>'#cc99ff','action'=>'jy_pingdd_pin/index/','image'=>'../addons/jy_weishop/resource/images/jy_weishoparticle.png'),
			//array('title'=>'推荐','icon'=>'icon-viewlist','color'=>'#66cc99','action'=>'jy_pingdd_pin/goods.index/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'拼单','icon'=>'icon-yonghujieru','color'=>'#66cc66','action'=>'jy_pingdd_pin/myteam/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
			array('title'=>'我的','icon'=>'icon-wo1','color'=>'#FF83FA','action'=>'jy_pingdd_pin/myhome/','image'=>'../addons/jy_weishop/resource/images/jy_fenleimsg.png'),
	);
	$hdps =array(
		array('title'=>'1','picurl'=>'../addons/jy_pingdd_pin/resource/images/hdp01.jpg'),
		array('title'=>'2','picurl'=>'../addons/jy_pingdd_pin/resource/images/hdp02.jpg'),
	);
	$item=$this->plugin_setting('basic');
	$my_days = array(
			array('title'=>'我的优惠券','icon'=>'icon-youhuiquan','color'=>'#cc99ff','action'=>'jy_weishop/coupon.myindex/'),
			array('title'=>'微信会员卡','icon'=>'icon-daifahuo','color'=>'#cc99ff','action'=>'core/member.wxcard/main/'),
			array('title'=>'余额提现','icon'=>'icon-dixiaofei','color'=>'#cc99ff','action'=>'core/member.tixian/'),
			array('title'=>'地址管理','icon'=>'icon-position','color'=>'#cc99ff','action'=>'core/member.address/'),
			array('title'=>'帮助中心','icon'=>'icon-help','color'=>'#cc99ff','action'=>'jy_weishop/news.list/'),
			array('title'=>'获得购物卡','icon'=>'icon-qiangdan','color'=>'#cc99ff','action'=>'jy_weishop/member.getcard/'),
			array('title'=>'我的购物车','icon'=>'icon-gouwuche','color'=>'#cc99ff','action'=>'jy_weishop/member.cart/'),
			array('title'=>'我的购物卡','icon'=>'icon-pingzhengzhongxin','color'=>'#cc99ff','action'=>'jy_weishop/member.mycard/'),
			array('title'=>'我的关注','icon'=>'icon-woguanzhudepinpai','color'=>'#cc99ff','action'=>'jy_weishop/member.favorite/'),
			array('title'=>'我的足迹','icon'=>'icon-zuji','color'=>'#cc99ff','action'=>'jy_weishop/member.history/'),
	);
	$item['my_days'] = !empty($item['my_days']) ? $item['my_days'] : $my_days;
	$item['demomy_days'] = $my_days;
	$my_logs = array(
			array('title'=>'积分日志','icon'=>'icon-jifen','color'=>'#cc99ff','action'=>'core/member.credit_log/'),
			array('title'=>'余额日志','icon'=>'icon-jiangjiatongzhi','color'=>'#cc99ff','action'=>'core/member.credit_log/'),
			array('title'=>'提现日志','icon'=>'icon-trade','color'=>'#cc99ff','action'=>'core/member.cash_log/'),
			array('title'=>'红包日志','icon'=>'icon-ai-hongbao','color'=>'#cc99ff','action'=>'core/member.red_log/'),
	);
	$item['my_logs'] = !empty($item['my_logs']) ? $item['my_logs'] : $my_logs;
	$item['demomy_logs'] = $my_logs;
	$my_memberbtn = array(
			array('title'=>'小程序直播','icon'=>'icon-video','color'=>'#cc99ff','action'=>'jy_weishop/sale.live_index/'),
			array('title'=>'领取优惠券','icon'=>'icon-youhuiquan1','color'=>'#cc99ff','action'=>'jy_weishop/coupon.index/'),
			array('title'=>'领取微信会员卡','icon'=>'icon-huiyuanqia','color'=>'#cc99ff','action'=>'core/member.wxcard/main'),
			array('title'=>'积分排行','icon'=>'icon-paixing','color'=>'#cc99ff','action'=>'jy_weishop/member.rank/'),
	);
	$item['my_memberbtn'] = !empty($item['my_memberbtn']) ? $item['my_memberbtn'] : $my_memberbtn;
	$item['demomy_memberbtn'] = $my_memberbtn;
	$return['item']=$item;
	$return['item']['bao_type']=intval($return['item']['bao_type']);
	//只默认第一次；
	$return['item']['bankuai']=$return['item']['bankuai']?$return['item']['bankuai']:$bankuai;
	$return['item']['footernav']=$return['item']['footernav']?$return['item']['footernav']:$footernav;
	$return['item']['hdps']=$return['item']['hdps']?$return['item']['hdps']:$hdps;
	$return['get_type']=$this->get_types;
	$planurl=custom_url('jy_pingdd_pin/plan/',true);
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'tip','title'=>'【务必】添加计划任务，否则自动拼团，预约等不正常（管理员可操作）！：</br>
					[两种设置计划任务的方法]：大家视情况二选一即可！</br>
					[注意]：<red>不能两种计划任务同时执行，否则会出现重复参团的情况；每次执行间隔时间不能低于1分钟，建议30分钟为优。</red></br>
					1、计划任务：系统--云服务--计划任务;任务URL：jy_pingdd_pin/plan/</br>
					2、宝塔等面板直接添加(<red>推荐方法</red>)：任务URL：'.$planurl.'
					'),
					array('type'=>'string','title'=>'网站名称','name'=>'title'),
					array('type'=>'image','title'=>'网站logo','name'=>'logo'),
					array('type'=>'switch','title'=>'开启自动退款?','name'=>'is_zdrefund','help'=>'开启后，自动退款（原路返回），如果是微信支付的，就微信退款，这时请确保微信商户支付--运营账户里面有钱'),
					array('type'=>'switch','title'=>'允许重复拼单?','name'=>'is_morepin'),
					array('type'=>'switch','title'=>'支持订单转积分?','name'=>'is_zhuan','help'=>'开启后，拼单成功的客户可以不要商品，直接按比例转成积分！（比例设置：营销--基本功能--抵扣设置--积分抵扣比例，逆向转换）'),
					array('type'=>'switch','title'=>'开启当日参与才能获得佣金?','name'=>'is_daycanyu','help'=>'开启后，只有当天参与的拼团的，才能获得佣金！'),
					//array('type'=>'unitstring','unit'=>'元','title'=>'保证金（元）','name'=>'bao_fee','show'=>array('bao_type'=>1),'help'=>'拼单要交付的保证金额！'),
					//array('type'=>'unitstring','unit'=>'%','title'=>'保证金%','name'=>'bao_rate','show'=>array('bao_type'=>0),'help'=>'拼单要交付的保证金比例！'),
					//array('type'=>'unitstring','unit'=>'%','title'=>'默认拼单%','name'=>'groupdiscount','help'=>'如果商品没用单独设置拼单折扣，就用默认折扣！'),
					//array('type'=>'unitstring','title'=>'成团人数','name'=>'teamnum','unit'=>'人','help'=>''),
					//array('type'=>'unitstring','title'=>'组团限时','name'=>'timeout','unit'=>'小时','help'=>'仅填数字，单位:小时'),
					//array('type'=>'unitstring','title'=>'返现比例','name'=>'fan_rate','unit'=>'%'),
					array('type'=>'switch','title'=>'自动成团?','name'=>'zd_team','help'=>'开启后，组团限时内未成团的，自动拼单成功！'),
					array('type'=>'switch','title'=>'关闭显示顶部分类?','name'=>'no_groups'),
					//array('type'=>'radio','title'=>'收货方式','name'=>'get_type','options'=>'get_type'),
					array('type'=>'image','title'=>'网站ICO','name'=>'icon'),
					array('type'=>'image','title'=>'首页顶部背景','name'=>'topbg','help'=>'高380，宽750'),
					array('type'=>'image','title'=>'首页横幅广告','name'=>'indexad','help'=>'高160，宽750'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
					'title'=>'文字自定义',
					'list'=>array(
						array('type'=>'text','title'=>'商品描述1','name'=>'goodstitle1','help'=>'变量解析：{teamnum}是成团人数，{fannum}失败人数，{lastnum}拼中人数，{zhong_fee}是拼中奖励，{fan_fee}是失败奖励；默认例如：{teamnum}人拼团，{lastnum}人得商品+{zhong_fee}元'),
						array('type'=>'text','title'=>'商品描述2','name'=>'goodstitle2','help'=>'变量解析：{teamnum}是成团人数，{fannum}失败人数，{lastnum}拼中人数，{zhong_fee}是拼中奖励，{fan_fee}是失败奖励；默认例如：{fannum}人，每人奖励{fan_fee}红包补贴'),
						array('type'=>'text','title'=>'简单规则描述','name'=>'goodsdesc1','help'=>'（商品详情底部，下单页面底部显示）变量解析：{teamnum}是成团人数，{fannum}失败人数，{lastnum}拼中人数，{zhong_fee}是拼中奖励，{fan_fee}是失败奖励；默认例如：{teamnum}人成团,随机抽{lastnum}人拼中,没抽中的人获得{fan_fee}元奖励金！'),
					)
			),
			array(
					'title'=>'拼单规则',
					'list'=>array(
						array('type'=>'richtext','title'=>'拼单规则','name'=>'rules','help'=>''),
					)
			),
			array(
					'title'=>'界面UI配色',
					'list'=>array(
						array('type'=>'color_pool','title'=>'选择配色方案','name'=>'syscolor','help'=>''),
						array('type'=>'colorpicker','title'=>'站点颜色','name'=>'syscolor','help'=>'自定义系统颜色系，默认： #18bc9c'),
						array('type'=>'phone_tpl','name'=>'syscolor'),
					)
			),
			array(
				'title'=>'幻灯片',
					'list'=>array(
						array(
							'type'=>'array',
							'name'=>'hdps',
							'add_tip'=>'添加一个幻灯片',
								'list'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片'),
									array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
									
								),
								'details'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片','help'=>''),
									array('type'=>'link','from'=>'action','name'=>'url','title'=>'幻灯片链接'),
									
								)
						)
					)
			),
			array(
				'title'=>'板块导航',
					'list'=>array(
									array('type'=>'array','name'=>'bankuai','add_tip'=>'添加一个板块导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),							
										array('type'=>'link','from'=>'action','name'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			array(
					'title'=>'会员中心页面开关设置',
					'list'=>array(
						array('type'=>'tip','title'=>'如需DIY会员中心页面：移步DIY装修--添加页面--页面类型--选择会员中心'),
						array('type'=>'switch','title'=>'关闭我的订单','name'=>'no_order'),
						array('type'=>'switch','title'=>'关闭待激活商品','name'=>'no_verify'),
						array('type'=>'switch','title'=>'关闭我的日常','name'=>'no_days'),
						array('type'=>'switch','title'=>'关闭售后客服','name'=>'no_shkefu'),
						array('type'=>'updemo','name'=>'my_days','demo'=>'demomy_days','title'=>'重置我的日常','help'=>'不知道添加什么我的日常？重置默认的一下试试！'),
						array('type'=>'array','title'=>'我的日常','name'=>'my_days','add_tip'=>'添加一个我的日常',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'日常名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'日常图标'),
										array('type'=>'string','name'=>'action','title'=>'日常链接'),
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'日常名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'日常图标'),
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'日常链接'),
									)
						),
						array('type'=>'switch','title'=>'关闭我的记录','name'=>'no_logs'),
						array('type'=>'updemo','name'=>'my_logs','demo'=>'demomy_logs','title'=>'重置我的记录','help'=>'不知道添加什么我的记录？重置默认的一下试试！'),
						array('type'=>'array','title'=>'我的记录','name'=>'my_logs','add_tip'=>'添加一个我的记录',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'记录名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'记录图标'),
										array('type'=>'string','name'=>'action','title'=>'记录链接'),
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'记录名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'记录图标'),
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'记录链接'),
									)
						),
						array('type'=>'tip','title'=>'其他导航列表'),
						array('type'=>'switch','title'=>'关闭其他导航','name'=>'no_others'),
						array('type'=>'updemo','name'=>'my_memberbtn','demo'=>'demomy_memberbtn','title'=>'重置导航','help'=>'不知道添加什么导航？重置默认的一下试试！'),
						array('type'=>'array','title'=>'其他导航','name'=>'my_memberbtn','add_tip'=>'添加一个导航按钮',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
						),
					)
				),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
